#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
#include<math.h>
int main()
{
	for (int i = 0; i <= 100000; i++)
	{
		int k = i;
		int sum = 0;
		while (k)
		{
			sum += pow(k % 10,3);
			k/= 10;
		}
		if (i == sum)
			printf("%d ",i);
	}
	return 0;
}